package cn.com.jrj.domain;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

/**
 * 股票信息对象,包含自选股和用户手机号,股票价格等信息. 用来封装查询满足预警条件的自选股数据
 * 
 * @author xiaoyu.dou 
 */
public class StockInfo implements RowMapper {

	/** 用户ID */
	private String uid;

	/** 手机 */
	private String mobile;

	/** 自选股ID */
	private int mystock_id;

	/** 现价 */
	private double now_price;
	
	/** 预警条件-大于 */
	public static final int WARN_CONDITION_GREAT = 2;

	/** 预警条件-小于 */
	public static final int WARN_CONDITION_LESS = 1;

	/** 预警条件: 2:大于, 1:小于 */
	private int warn_condition;

	/** 用户设定的预警价格 */
	private double warn_price;

	/** 股票代码 */
	private String stock_code;

	/** 股票名称 */
	private String stock_name;
	
	/** 涨跌幅 */
	private double zdf;

	@Override
	public Object mapRow(ResultSet rs, int index) throws SQLException {
		StockInfo s = new StockInfo();
		s.setUid(rs.getString("SR_InputNo"));
		s.setMobile(rs.getString("SR_Tel"));
		s.setMystock_id(rs.getInt("SR_ID"));
		s.setNow_price(rs.getDouble("now_price"));
		s.setWarn_condition(rs.getInt("SR_Conditions"));
		s.setWarn_price(rs.getDouble("SR_TPrice"));
		s.setStock_code(rs.getString("stock_code"));
		s.setStock_name(rs.getString("stock_name"));
		s.setZdf(rs.getDouble("zdf"));
		return s;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public int getMystock_id() {
		return mystock_id;
	}

	public void setMystock_id(int mystockId) {
		mystock_id = mystockId;
	}

	public double getNow_price() {
		return now_price;
	}

	public void setNow_price(double nowPrice) {
		now_price = nowPrice;
	}

	public int getWarn_condition() {
		return warn_condition;
	}

	public void setWarn_condition(int warnCondition) {
		warn_condition = warnCondition;
	}

	public double getWarn_price() {
		return warn_price;
	}

	public void setWarn_price(double warnPrice) {
		warn_price = warnPrice;
	}

	public String getStock_code() {
		return stock_code;
	}

	public void setStock_code(String stockCode) {
		stock_code = stockCode;
	}

	public String getStock_name() {
		return stock_name;
	}

	public void setStock_name(String stockName) {
		stock_name = stockName;
	}

	public double getZdf() {
		return zdf;
	}

	public void setZdf(double zdf) {
		this.zdf = zdf;
	}

}
